//package com.office.utils;
//
//import com.office.dataobject.BusinessExcelCompany;
//import com.office.dataobject.WebmagicCircles;
//
//import java.sql.*;
//
//public class DBUtils {
//
//    private static final String driver = "com.mysql.jdbc.Driver";
//    private static Connection con;
//    private static String sqldata = "jdbc:mysql://localhost:3306/office?useUnicode=true&characterEncoding=utf8&&useSSL=false";
//    private static PreparedStatement ps;
//    private static ResultSet rs;
//
//    public static Connection getConnection() {
//        try {
//            Class.forName(driver);
//            con = DriverManager.getConnection(sqldata, "root", "root");
//        } catch (Exception e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }
//        return con;
//    }
//
//    public static void insertTable(WebmagicCircles circles) {
//        Connection connection = getConnection();
//        try {
//            String sql = "INSERT INTO webmagic_circles (company_name,unit_code,contacts_user,phone,price,birthday) VALUES (?,?,?,?,?,?)";
//            ps = connection.prepareStatement(sql);
//            ps.setString(1, circles.getCompanyName());
//            ps.setString(2, circles.getUnitCode());
//            ps.setString(3, circles.getContactsUser());
//            ps.setString(4, circles.getPhone());
//            ps.setString(5, circles.getPrice());
//            ps.setString(6, circles.getBirthday());
//            int result = ps.executeUpdate();
//        } catch (SQLException e) {
//            e.printStackTrace();
//        }
//    }
//
//    public static void insertExcelTable(BusinessExcelCompany excelCompany) {
//        Connection connection = getConnection();
//        try {
//            String sql = "INSERT INTO business_excel_company (company_name,contacts_user,phone,mail_list) VALUES (?,?,?,?)";
//            ps = connection.prepareStatement(sql);
//            ps.setString(1, excelCompany.getCompanyName());
//            ps.setString(2, excelCompany.getContactsUser());
//            ps.setString(3, excelCompany.getPhone());
//            ps.setString(4, excelCompany.getMailList());
//            int result = ps.executeUpdate();
//        } catch (SQLException e) {
//            e.printStackTrace();
//        } finally {
//            if (connection != null) {
//                try {
//                    connection.close();
//                } catch (SQLException e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//    }
//}
